package com.eastmountain.util;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintStream;
import java.util.Iterator;

public class PrintFile {

    private static PrintStream printStream = null;
    private static File file = null;

    public PrintFile( File file ) {

        this.file = file;

        try {

            printStream = new PrintStream(file);

        } catch ( FileNotFoundException FileNotFoundException ) {

        }

    }

    public PrintFile( String fileName ) {

        file = new File(fileName);

        try {

            printStream = new PrintStream(file);

        } catch ( FileNotFoundException FileNotFoundException ) {

        }

    }

    public static void println( String label, int element ) {
        
        printStream.println( label + " " + element );
        
    }

    public static void println( String label, String element ) {
        
        printStream.println( label + " " + element );
        
    }  

    public static void println( String label, String[] elements ) {
        
        printStream.println( " \n" + label  );
        
        for ( String element : elements ) {
            
            printStream.print( element + " " );
       
        }
        
        printStream.println();
        
    }

    public static void println() {
        
        printStream.println();
        
    }

    public static boolean delete() {
        
        boolean ok = false;
        
        if ( file != null ) {
            
            ok = file.delete();
        }
        
        return( ok );
        
    }

}